package com.huanlis.provider.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class HelloController {

    @GetMapping("/hello/test")
    public ResponseEntity<String> getTest(@RequestParam("id") Integer id) {
        log.info("收到请求：{}----{}", Thread.currentThread().getName(), id);
        try {
            Thread.sleep(1000 * 10);
        } catch (InterruptedException e) {
            log.error("收到请求：{}----{}: {}", Thread.currentThread().getName(), id, "延时错误");
            throw new RuntimeException(e);
        }
        log.info("返回结果：{}----{}", Thread.currentThread().getName(), id);
        return ResponseEntity.ok("id : " + id);
    }

}
